import extend from 'dva-model-extend'
import settings from '@/settings'
import model from '@/baseModel'
import { analysis } from '@/services/api'

const { pagination } = settings

export default extend(model, {
	namespace: 'analysis',
	effects: {
		*fetchAll({
			payload = pagination
		}, {
			call,
			put
		}) {
			const { data } = yield call(analysis, payload)
			yield put({
				type: 'updateState',
				payload: {
					list: data,
					params: payload
				}
			})
		}
	}
})